<?php

class pdfUtil {

  public static function create($templateName, $arrData) {

    require_once(dirname(__FILE__) . '/../vendor/html2fpdf/html2fpdf.php');
    sfProjectConfiguration::getActive()->loadHelpers('Partial');
    $content = get_partial('global/pdf/'.$templateName, $arrData);
    $fileName = sfConfig::get('sf_data_dir') . "/pdf/" . $arrData['ticid'] . ".pdf";

    $pdf = new HTML2FPDF();
    $pdf->AddPage();
    $pdf->WriteHTML($content);
    $pdf->Output($fileName);

    if (file_exists($fileName)) {
      return $fileName;
    }
    return false;
    
  }

}

?>
